<?php
	require_once 'models/models_mathang.php';
	require_once 'models/models_loaihang.php';
	require_once 'models/models_cthoadon.php';
	require_once 'models/models_binhluan.php';
	$obbl=new models_binhluan();
	

	$obMh = new models_mathang();
	$p=new pagermain();
	$oblh = new models_loaihang();
	$obcthd=new models_cthoadon();
	
		
		
if(isset($_GET['mod']))
{
	switch ($_GET['mod'])
	{
		case 'sanpham':
			{
			 	$limit=6;
				$count=$obMh->tongsodongid($_GET['id']);
				$start=$p->findstart($limit);
				$page=$p->findpages($count,$limit);
				$data['list'] = $obMh->_list($start, $limit, $_GET['id']);
				$pagelist=$p->pagelist($_GET['page'],$page);
			 
				require 'views/main/sanpham/index.php';
				break;
			}
		case 'detail':
			{
				$data = $obMh->_detail($_GET['id']);
				$com['list']=$obbl->_getbinhluan($_GET['id']);
				require 'views/main/sanpham/detailsp.php';
				break;
			}
		
	
			case 'sanphambanchay':{
				$data['spbc']=$obcthd->sanphanbanchay();
			$data['list']=$obMh->listMatHang();
			require 'views/main/sanphambanchay/sanphambanchay.php';
			break;
			}
		
		
       			default:{
				echo "Dữ liệu đang cập nhật";
				break;
			}
		
	}
}


	
	

?>